//
//  InfoViewController.m
//  MyLittleBrother
//
//  Created by speeda on 17/7/30.
//  Copyright © 2017年 speeda. All rights reserved.
//

#import "PrizeViewController.h"
#import "OpenBoxView.h"
#import "PrizeCell.h"
#import "OpenBoxView.h"

@interface PrizeViewController () <UITableViewDataSource,UITableViewDelegate>

@property (weak, nonatomic) IBOutlet UIView *topOpenBoxView;
@property (weak, nonatomic) IBOutlet UITableView *prizeTableView;
@property (nonatomic, strong) NSMutableArray *prizeArray;

@end

@implementation PrizeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self initView];
}

- (void)initView {
    
    self.title = @"奖品";
    self.prizeTableView.dataSource = self;
    self.prizeTableView.delegate = self;
    self.prizeTableView.estimatedRowHeight = 100;
    self.prizeTableView.rowHeight = UITableViewAutomaticDimension;
    self.prizeTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    
}

- (IBAction)openBoxBtnAction:(id)sender {
    
    [OpenBoxView openBoxViewFormXib];
}


#pragma mark -- UITableViewDataSource,UITableViewDelegate
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    return self.prizeArray.count;
}



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    static NSString *prizeCell = @"prizeCell";
    PrizeCell *cell = [tableView dequeueReusableCellWithIdentifier:prizeCell];
    if (cell == nil) {
        NSArray *nibs = [[NSBundle mainBundle] loadNibNamed:@"PrizeCell" owner:nil options:nil];
        cell = [nibs lastObject];
    }

    return cell;
}


- (NSMutableArray *)prizeArray {
    
    if (!_prizeArray) {
        _prizeArray = [NSMutableArray arrayWithObjects:@"1",@"2",@"3",@"4",@"5", nil];
    }
    
    return _prizeArray;
}




@end
